package com.ruoyi.rel.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.rel.domain.AcupointImageCategoryRel;
import com.ruoyi.rel.service.IAcupointImageCategoryRelService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 图片-穴位分类关联Controller
 * 
 * @author ruoyi
 * @date 2025-10-10
 */
@RestController
@RequestMapping("/rel")
public class AcupointImageCategoryRelController extends BaseController
{
    @Autowired
    private IAcupointImageCategoryRelService acupointImageCategoryRelService;

    /**
     * 查询图片-穴位分类关联列表
     */
    @RequiresPermissions("rel:rel:list")
    @GetMapping("/list")
    public TableDataInfo list(AcupointImageCategoryRel acupointImageCategoryRel)
    {
        startPage();
        List<AcupointImageCategoryRel> list = acupointImageCategoryRelService.selectAcupointImageCategoryRelList(acupointImageCategoryRel);
        return getDataTable(list);
    }

    /**
     * 导出图片-穴位分类关联列表
     */
    @RequiresPermissions("rel:rel:export")
    @Log(title = "图片-穴位分类关联", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, AcupointImageCategoryRel acupointImageCategoryRel)
    {
        List<AcupointImageCategoryRel> list = acupointImageCategoryRelService.selectAcupointImageCategoryRelList(acupointImageCategoryRel);
        ExcelUtil<AcupointImageCategoryRel> util = new ExcelUtil<AcupointImageCategoryRel>(AcupointImageCategoryRel.class);
        util.exportExcel(response, list, "图片-穴位分类关联数据");
    }

    /**
     * 获取图片-穴位分类关联详细信息
     */
    @RequiresPermissions("rel:rel:query")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(acupointImageCategoryRelService.selectAcupointImageCategoryRelById(id));
    }

    /**
     * 新增图片-穴位分类关联
     */
    @RequiresPermissions("rel:rel:add")
    @Log(title = "图片-穴位分类关联", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AcupointImageCategoryRel acupointImageCategoryRel)
    {
        return toAjax(acupointImageCategoryRelService.insertAcupointImageCategoryRel(acupointImageCategoryRel));
    }

    /**
     * 修改图片-穴位分类关联
     */
    @RequiresPermissions("rel:rel:edit")
    @Log(title = "图片-穴位分类关联", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody AcupointImageCategoryRel acupointImageCategoryRel)
    {
        return toAjax(acupointImageCategoryRelService.updateAcupointImageCategoryRel(acupointImageCategoryRel));
    }

    /**
     * 删除图片-穴位分类关联
     */
    @RequiresPermissions("rel:rel:remove")
    @Log(title = "图片-穴位分类关联", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(acupointImageCategoryRelService.deleteAcupointImageCategoryRelByIds(ids));
    }
}
